#include <stdio.h>

int main ()
{
	int n = 0;
	int num = 0;
	int i = 0;
	int arr1[100] = {0};
	int arr2[100] = {0};
	int arr3[100] = {0};
	
	scanf("%d",&n);
	while(i<n)
	{
		scanf("%d",&num);
		arr1[i] = num;
		scanf("%d",&num);
		arr2[i] = num;
		scanf("%d",&num);
		arr3[i] = num;
		i++;
	}
	i = 0;
	while(i<n)
	{
		arr1[n]+=arr1[i];
		arr2[n]+=arr2[i];
		arr3[n]+=arr3[i];
		i++;
	}
	printf("%d %d %d %d",arr1[n],arr2[n],arr3[n],arr1[n]+arr2[n]+arr3[n]);
	
	return 0;
 } 
